package com.hanoi.wiki.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.hanoi.wiki.model.json.LogJson;

@Entity
@Table(name="LOG")
public class Log implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public Log() {
		
	}
	
	public Log(LogJson json) {
		this.updatedTime 	= json.getUpdatedTime();
		this.detail			= json.getDetail();
	}
	
	@Id
	@Column(name="ID")
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;
	
	@Column(name="UPDATED_TIME")
	private Date updatedTime;
	
	@Column(name="DETAIL", length = 2000, nullable = false)
	private String detail;
	
	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) 
	private Places places;
	
	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) 
	private PlacesInQueued placesInQueued;
	
	public PlacesInQueued getPlacesInQueued() {
		return placesInQueued;
	}
	public void setPlacesInQueued(PlacesInQueued placesInQueued) {
		this.placesInQueued = placesInQueued;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public Date getUpdatedTime() {
		return updatedTime;
	}
	public void setUpdatedTime(Date updatedTime) {
		this.updatedTime = updatedTime;
	}
	public String getDetail() {
		return detail;
	}
	public void setDetail(String detail) {
		this.detail = detail;
	}
	public Places getPlaces() {
		return places;
	}
	public void setPlaces(Places places) {
		this.places = places;
	}
	
}
